package com.xiaobange.utils;

import cn.dev33.satoken.secure.SaSecureUtil;

/**
 * @version 1.0
 * @Author 小班哥
 * @Date 2025/5/9 12:39
 * @Explain
 */
public class PasswordUtil {

    private final static String SECURITY_KEY = "XiaoBanGe";

    /**
     * 对密码进行对称加密
     * @param plaintext 明文密码
     * @return 结果
     */
    public static String passwordEncryption(String plaintext){
        return SaSecureUtil.aesEncrypt(SECURITY_KEY,plaintext);
    }


    /**
     * 对密文密码进行解密
     * @param ciphertext 密文
     * @return 结果
     */
    public static String passwordDecode(String ciphertext){
        return SaSecureUtil.aesDecrypt(SECURITY_KEY,ciphertext);
    }
}
